//
//  HomeGoodsDoubleItemView.m
//  TerritoryShopkeeper
//
//  Created by xiaowu on 2017/12/5.
//  Copyright © 2017年 ZDQK. All rights reserved.
//

#import "HomeGoodsDoubleItemView.h"

@implementation HomeGoodsDoubleItemView

+ (CGFloat)getHeight {
    return 77 + (ScreenWidth-1) * 0.5;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        [self configure];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self configure];
    }
    return self;
}

- (void)configure {
    self.view = [[[NSBundle mainBundle] loadNibNamed:@"HomeGoodsDoubleItemView" owner:self options:nil] firstObject];
    self.view.frame = self.bounds;
    [self addSubview:self.view];
    
    
    self.nameLabel.font = TextPingFangFontSize(14);
    self.nameLabel.textColor = [UIColor blackTextColor];
    
    self.priceLabel.font = TextPingFangMediumFontSize(16);
    self.priceLabel.textColor = [UIColor redF2color];
    
    self.oldPriceLabel.font = TextPingFangFontSize(10);
    self.oldPriceLabel.textColor = [UIColor gray66Color];
    
    self.iconImageView.backgroundColor = [UIColor imageEDBackgroundColor];
}

- (IBAction)buttonClick:(id)sender {
    if (self.block) {
        self.block();
    }
}

- (void)setItemViewWithItem:(HomeGoodsItem *)model {
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.gimg] placeholderImage:PlaceholderImageBig changeContentModel:UIViewContentModeScaleAspectFill];
    self.nameLabel.text = model.gname;
    self.priceLabel.text = [NSString stringWithFormat:@"¥%@",model.gprice];
    self.oldPriceLabel.text = [NSString stringWithFormat:@"¥%@", model.goldprice];
}


@end
